clear all;
clc;

load mnist_all;

data = [train0];

distance = 0.6;
graphdim = 10;

A = buildgraph(double(data),distance);

%check connected
[S,~] = graphconncomp(A,'Directed',false);
if(S > 1) 
    error('Graph not connected! Try more neighbors.');
end

%[V,M] = fastmvudnn(data,distance,graphdim);